﻿using System;
using System.Text;
using Autodesk.Revit.DB;

namespace HYRevitCode.DocumentUtiltiy
{
	public static class DocumentUtilityMethod
	{
		public static bool TryGetDocumentGuid(Autodesk.Revit.DB.Document inputDoc, out string guidResult)
		{
			guidResult = null;
			if (inputDoc == null || string.IsNullOrWhiteSpace(inputDoc.PathName))
			{
				return false;
			}
			DocumentVersion documentVersion = BasicFileInfo.Extract(inputDoc.PathName).GetDocumentVersion();
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(documentVersion.VersionGUID.ToString());
			guidResult = stringBuilder.ToString();
			return true;
		}
	}
}
